package com.talent.mapper;

import com.talent.pojo.entity.ImportRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 导入记录Mapper
 */
@Mapper
public interface ImportRecordMapper {

    /**
     * 新增导入记录
     */
    void insert(ImportRecord importRecord);
    /**
     * 根据批次ID查询导入记录
     */
    List<ImportRecord> getAll();

    /**
     * 根据批次ID统计导入结果
     */
    ImportSummary getSummary();

    @Select("SELECT COUNT(*) > 0 FROM import_records WHERE status = 'COMPLETE'")
    Boolean isCompeted();

    /**
     * 删除所有导入记录（清空表）
     */
    void deleteAll();

    /**
     * 导入结果统计内部类
     */
    class ImportSummary {
        private Integer totalCount;
        private Integer successCount;
        private Integer failedCount;

        // getter和setter方法
        public Integer getTotalCount() { return totalCount; }
        public void setTotalCount(Integer totalCount) { this.totalCount = totalCount; }
        
        public Integer getSuccessCount() { return successCount; }
        public void setSuccessCount(Integer successCount) { this.successCount = successCount; }
        
        public Integer getFailedCount() { return failedCount; }
        public void setFailedCount(Integer failedCount) { this.failedCount = failedCount; }
    }
}
